package com.SuanZhengYi.ZhengZeBiaoDaShi;

import java.util.Arrays;

public class RegexTest3 {
    public static void main(String[] args) {
        //将人名分割出来
        String s1="古力娜扎ai8888迪丽热巴999aa5566马儿扎哈fbbfsfs42425卡尔扎巴";
        System.out.println(s1.replaceAll("\\w+", "-"));
        //将重复的字去掉
        String s2="我我我喜欢编编编编编编编编编编程程程程程";
        System.out.println(s2.replaceAll("(.)\\1+", "$1"));
        //按照正则表达式匹配的内容进行分割返回一个字符串
        String rs3="古力娜扎ai8888迪丽热巴999aa5566马儿扎哈fbbfsfs42425卡尔扎巴";
       String[]names=rs3.split("\\w+");
        System.out.println(Arrays.toString(names));
    }
}
